import Vue from 'vue'
import VueCookies from 'vue-cookies'
Vue.use(VueCookies)

//-设置一个cookie
export function cookiesSet(keyName,value,date){
    return VueCookies.set(keyName, value,date)   //return this
}
//-获取一个cookie
export function cookiesGet(keyName){
    return VueCookies.get(keyName)       // return value   
}
//-删除一个cookie
export function cookiesRemove(keyName){
    return VueCookies.remove(keyName)   // return this
}
//-检查某个 cookie name是否存在
export function cookiesIsKey(keyName){
    return VueCookies.isKey(keyName)        // return false or true
}
//-获取所有 cookie name，以数组形式返回
export function cookiesKeys(){
    return VueCookies.keys()  // return a array
}

//过期时间示例
//不写过期时间，默认为1天过期
//VueCookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX")

// 1天过期，忽略大小写
//VueCookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX","1d")
//VueCookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX","1D")

// 以秒为单位，设置1天过去
//VueCookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX",60 * 60 * 24)

// 填写Date对象，明确指定过期时间
//VueCookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX", new Date(2017, 03, 12))

// 填写一个时间字符串，指定过期时间
//VueCookies.set("user_session","25j_7Sl6xDq2Kc3ym0fmrSSk2xV2XkUkX", "Sat, 13 Mar 2017 12:25:57 GMT")

//浏览器会话结束时过期
//VueCookies.set("default_unit_second","input_value","0");
 
//永不过期
//VueCookies.set("default_unit_second","input_value",-1); 